<template>
    <view>
        <cu-custom bgColor="bg-white" :isBack="true">
            <block slot="content">修改登录密码</block>
        </cu-custom>
        <view class="padding">
            <view class="item crow bg-white radius-xl margin-bottom">
                <view class="right">
                    <input type="text" class="padding box-unset" placeholder="新密码" v-model="form.password">
                </view>
            </view>
            <view class="item crow bg-white radius-xl margin-bottom">
                <view class="right">
                    <input type="text" class="padding box-unset" placeholder="确认密码" v-model="form.vpassword">
                </view>
            </view>

            <view class="padding margin-top-lg">
                <view class="flex flex-direction">
                    <button class="cu-btn china-btn-bg lg round" @click="submit()">提交</button>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            form: {
                password: '',
                vpassword: '',
            }
        };
    },
    onLoad() {
    },
    methods: {
        submit() {
            uni.showLoading({ title: '保存中...' });
            this.$utils.$api.User.password(this.form).then(res => {
                uni.hideLoading();
                this.$utils.$message.success(res.msg);
                setTimeout(() => {
                    this.$utils.$page.back();
                }, 1000);
            }).catch(err => {
                uni.hideLoading();
                this.$utils.$message.error(err.msg);
            })
        },
    }
}
</script>

<style lang="scss" scoped>
.item {
    width: 100%;

    .right {
        flex: 1;

        input {
            font-size: 26upx;
        }
    }

    .locationfill {
        font-size: 35upx;
    }
}

.captcha-image {
    height: 40px;
    width: 100px;
}

.box-unset {
    box-sizing: unset;
}

.text-primary {
    color: var(--theme-color)
}

.text-dark-light-5 {
    color: $u-light-color;
}</style>
